﻿//-------------------------------------------------------------------
//	Copyright (c) 2010-2014  Zhirnov Andrey
//	This file is part of the "UX Standard Lib" project.
//	See copyright notice in "UX_DataBase.h".
//-------------------------------------------------------------------

#ifdef __UX_STL_UNIT_TEST__

#include "../ux_database.h"

using namespace UX_STL;
using namespace UXTypes;
using namespace UXDataBase;


struct DBIterator
{
	void BeginRow (uint numColumns)
	{}

	void EndRow ()
	{}

	void Column (uint index, uni_c_string name, uni_c_string value)
	{
		string	str;
	
		Utf8StringUtils::EncodeToWindows1251( value, str );

		DEBUG_CONSOLE( ( string(name) << " " << str ).cstr() );
	}
};


void Test0 ()
{
	FileSystem::FindAndSetCurrentDir( "Tests", 5 );

	SimpleDB	db( "test.db" );

	DBIterator	iter;

	db.Exec( iter, "SELECT * from [0]", true );
}


#ifdef PLATFORM_WINDOWS
using namespace winapi;
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
#endif
{
	Test0();
	return 0;
}

#include "../../stl_core/ux_stl_core_lib.h"

#endif	__UX_STL_UNIT_TEST__